const mysql = require('mysql2');

const pool = mysql.createPool({
  host: process.env.DB_HOST,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_NAME, // 使用最新的数据库,
  // database:'db_2025_03',
  waitForConnections: true,
  connectionLimit: 20,
  queueLimit: 0,
});

// 转换为 Promise 接口
const promisePool = pool.promise();

module.exports = promisePool; 